package com.youlu.campus.web.invite.controller;

import com.youlu.campus.entity.VO.RankingListQueryVO;
import com.youlu.campus.service.ranking.UserInviteCountRankingService;
import com.youlu.campus.web.common.base.RequestContext;
import com.yuelin.infrastructure.quantum.common.QResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class UserInviteCountController {
    @Autowired
    private UserInviteCountRankingService userInviteCountRankingService;

    /**
     * 获取邀请数量排行榜
     * @param request
     * @return
     */
    @PostMapping("/mini-app/invite-count/ranking-list")
    public QResult getInviteCountRanking(@RequestBody RankingListQueryVO request) {
        request.setUserId(RequestContext.getUserId());
        request.setAppId(RequestContext.getAppId());
        request.setPlatform(RequestContext.getCurPlatform());
        return QResult.success(userInviteCountRankingService.getUserTaskRanking(request, RequestContext.getCurUser()));
    }
}
